<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.util.Arrays" %>
<%@include file="/public.jsp"%><%--
  Created by IntelliJ IDEA.
  User: Yzk20
  Date: 2025/7/1
  Time: 8:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="css/styless.css">
</head>
<body>
<nav class="navbar">
    <ul class="nav-list">
        <li><a href="index.jsp" class="nav-link">首页</a></li>
        <li><a href="about.jsp" class="nav-link">关于我们</a></li>
        <%
            if (session.getAttribute("login_account") != null){ %>
        <li><a href="book1.jsp" class="nav-link">图书列表</a></li>
        <li><a href="profile.jsp" class="nav-link">借阅信息</a></li>
        <li><a href="userxx.jsp" class="nav-link">我的账户</a></li>
        <li><a href="quit.jsp" class="nav-link">登出</a></li>
        <% } else { %>
        <!-- 否则显示登录和注册链接 -->
        <li><a href="login.jsp" class="nav-link">登录</a></li>
        <li><a href="register.jsp" class="nav-link">注册</a></li>
        <li><a href="book1.jsp" class="nav-link">图书列表</a></li>
        <% } %>
    </ul>
</nav>
<form>
<%
String login_account = (String) session.getAttribute("loginc");
String sql =" SELECT * FROM user t WHERE 1=1 AND t.login_account = ?";

PreparedStatement pstmt = conn.prepareStatement(sql);
pstmt.setString(1, login_account);
ResultSet rs = pstmt.executeQuery();
System.out.println("login_account:"+login_account);
    String storedUserName = (String) session.getAttribute("user");
    System.out.println(storedUserName);
%>
<%--    <table align="center" >--%>
<%--        <tr>--%>
<%--            <td>图书名称：<input type="text" name="bookName" id="bookName"></td>--%>
<%--        </tr>--%>
<%--        <tr>--%>
<%--            <td align="center" >--%>
<%--                <input type="hidden" name="actionType" value="book">--%>
<%--                <input type="submit" value="查询" >--%>
<%--                <input type="button" value="添加" onclick="book_add()">--%>
<%--            </td>--%>
<%--        </tr>--%>
<%--    </table>--%>
<%--    <hr>--%>
    <table align="center" width="80%" berder="1" >
        <h1 align="center">欢迎进入账号信息</h1>
        <tr>
            <td>用户ID</td>
            <td>用户账号</td>
            <td>用户密码</td>
            <td>电子邮箱</td>
            <td>操作</td>
        </tr>
        <tbody id="devList">
        <tr>
                <%
    while(rs.next()) {
%>
        <tr>
            <td><%=rs.getString("user_id")%></td>
            <td><%=rs.getString("login_account")%></td>
            <td><%=rs.getString("login_pwd")%></td>
            <td><%=rs.getString("email")%></td>


<%--            <td><%=rs.getString("date")%></td>--%>
<%--            <td><%=rs.getString("status")%></td>--%>
            <td>
                <input type="button" value="修改" onclick="accout_update(<%=rs.getString("user_id")%>)">
            </td>
            <%}%>

        </tr>
        </tbody>
    </table>
</form>
<script>
<%--    function book_add(){--%>

<%--        window.location.href = "book/book_add.jsp"--%>
<%--    }--%>
function accout_update(user_id){
    window.location.href = "accout/accout_update.jsp?user_id="+ user_id;
    }
<%--    function book_delete(bookid){--%>
<%--        window.location.href = "book/book_delete.jsp?bookid="+ bookid;--%>
<%--    }--%>
</script>
</from>
</body>
</html>
